do "E:\yungyu\lottery_baby\do\set_environment.do"

capture log close
log using "$log\2.8.receipt_lottery_`c(current_date)'.log" , replace
clear
set more off

use "$wdata\all_winner_93109.dta", clear
keep if inrange(year,96,108) //Current winner = 96 to 101; future winner = 103 to 108
gen real_win_year = year

rename incm_pfn_idn_ban ban
merge m:1 year ban using "E:\yungyu\pre2022\wdata\bgm\tot_ban.dta"
keep if _m == 3

gen receipt_lott = head_ban == "2032510546"
keep if receipt_lott == 1

collapse (sum)payment, by(pers_idn real_win_year)
rename payment receipt_prize

save "$wdata\receipt_lott_prize.dta", replace

log close
